<h1><?=$this->translate->_('user_online_header')?></h1>

<?=$this->paginationControl($this->results, 'Sliding', 'pagination_control.phtml', array('route' => 'default'))?>

<?if($this->count > 0):?>
	<?$i=0;?>
	<table summary="user" class="table_users">
	<tr>
		<th width="20%"><?=$this->translate->_('user_online_name')?></th>
		<th width="20%"><?=$this->translate->_('user_online_ip')?></th>
		<th width="40%"><?=$this->translate->_('user_online_where')?></th>
		<th width="20%"><?=$this->translate->_('user_online_active')?></th>
	</tr>
	<?foreach($this->results AS $result):?>
	<?$i++;?>
	<tr>
		<td class="<?=$i%2 == 0 ? 'cell1' : 'cell2';?>">
			<?if($result['user_uid'] > 0):?>
			<a href="<?=$this->url(array('controller' => 'profile', 'action' => 'index', 'uid' => $result['user_uid']),'profile', true)?>">
				<?=$this->escape($result['username'])?>
			</a>
			<?else:?>
				<?=$this->translate->_('guest')?>
			<?endif;?>
		</td>
		<td class="<?=$i%2 == 0 ? 'cell1' : 'cell2';?>">
			<?if($result['ip_address'] > 0):?>
				<?$ip = explode('.', $result['ip_address']); ?>
				<span style="color:#666;"><?=$ip[0]?>.<?=$ip[1]?>.<?=$ip[2]?>.XXX</span>
			<?endif;?>
		</td>
		<td class="<?=$i%2 == 0 ? 'cell1' : 'cell2';?>">
			<?if($result['thread_uid'] > 0):?>
				<span style="color:#666; font-size:0.8em;"><?=$this->translate->_('user_online_thread')?></span>
				<a href="<?=$this->url(array('controller' => 'posts', 'uid' => $result['thread_uid'], 'title' => $this->escape($this->CleanUrlTitle($result['thread_title']))), 'threads', true);?>">
					<?=$this->escape($result['thread_title'])?>
				</a>
			<?elseif($result['board_uid'] > 0):?>
				<span style="color:#666; font-size:0.8em;"><?=$this->translate->_('user_online_board')?></span>
				<a href="<?=$this->url(array('controller' => 'threads', 'uid' => $result['board_uid'], 'title' => $this->escape($this->CleanUrlTitle($result['board_title']))), 'boards', true);?>">
					<?=$this->escape($result['board_title'])?>
				</a>
			<?elseif($result['module'] == 'backend'):?>
				<?=$this->translate->_('user_online_backend')?>
			<?elseif($result['controller'] != ''):?>
				<?=$this->translate->_('user_online_' . $result['controller'])?>
			<?else:?>
				<?=$this->translate->_('user_online_unknown')?>
			<?endif;?>
		</td>
		<td class="<?=$i%2 == 0 ? 'cell1' : 'cell2';?>">
			<span style="color:#666;"><?=$this->datetime($result['date'], 'HH:mm:ss')?></span>
		</td>
	</tr>
	<?endforeach;?>
	</table>
	<br />
	<?=$this->paginationControl($this->results, 'Sliding', 'pagination_control.phtml', array('route' => 'default'))?>
<?else:?>
	<p class="notice_bad"><?=$this->translate->_('user_error')?></p>
<?endif;?>